package com.leyou.httpdemo;

import com.leyou.httpdemo.pojo.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;

/**
 * @author RaoShuang
 * @emil 991207823@qq.com
 * @date 2020/11/19 21:21
 * 测试验证
 */
@Controller
public class HelloController {

    @Value("${pdf.test.file}")
    String pdfFile;

    @RequestMapping({"/", "/index"})
    public String index(Model model) {
        model.addAttribute("pdfFileUrl", pdfFile);
        return "index";
    }

    @RequestMapping("/hello")
    @ResponseBody
    public User hello() {
        User user = new User();

        user.setId(1L);
        user.setUserName("raos");
        user.setPassword("111111");
        user.setName("饶爽");
        user.setAge(18);
        user.setSex(1);
        user.setBirthday(new Date());
        user.setCreated(new Date());
        user.setUpdated(new Date());
        user.setNote("验证测试");

        return user;
    }
}
